from openpyxl import load_workbook

"""
比较计费规则变化情况
"""

preXlsx = "C:\Download\Result_0927.xlsx"
currXlsx = "C:\Download\Result_0928.xlsx"

# 打开文件
preFile = load_workbook(preXlsx)
currFile = load_workbook(currXlsx)
preActive = preFile["Result 1"]
currActive = currFile["Result 1"]

for item in preActive["A"]:
    for item2 in currActive["A"]:
        if item.value == item2.value:
            preRow = preActive[item.row]
            currRow = currActive[item2.row]
            if preRow[33].value != currRow[33].value:
                print(currRow[41].value)
                print(currRow[4].value)
                print("上次计费规则：" + preRow[33].value)
                print("今日计费规则：" + currRow[33].value)
                print()
            break

preFile.close()
currFile.close()
